package com.songlanyun.modules.comment.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.common.enums.CommentConstant;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.comment.entity.OrderGoodsComment;
import com.songlanyun.modules.comment.model.dto.OrderGoodsCommentDTO;
import com.songlanyun.modules.comment.model.vo.OrderGoodsCommentVO;
import com.songlanyun.modules.goods.entity.Goods;

import java.util.List;
import java.util.Map;

/**
 * 订单商品评论
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-30 18:09:47
 */
public interface OrderGoodsCommentService extends IService<OrderGoodsComment> {

    PageUtils queryPage(Map<String, Object> params);

    OrderGoodsComment getById(Long id, boolean isThrow);

    void saveComment(OrderGoodsCommentDTO dto);

    List<OrderGoodsComment> getMemberComments(Map<String, Object> params);

    /**
     * 计算商家所有评价的平均分
     *
     * @return
     */
    List<OrderGoodsCommentVO> getAvgByGoods();

    List<OrderGoodsCommentVO> getAvgByShop();

    /**
     * 统计商品评价
     *
     * @param userId
     * @return
     */
    Integer goodsEvaluateNum(Long userId, Long shopId, CommentConstant.CommentType type);

    PageUtils queryCommentPage(Map<String, Object> params);

    OrderGoodsComment getApiById(Long id);

    void modelDel(CommentConstant.CommentType type, Long id);

    /**
     * 获取用户对订单的评价
     *
     * @param type
     * @param userId
     * @param orderId
     * @return
     */
    OrderGoodsComment getMemberComments(CommentConstant.CommentType type, Long userId, String orderId);

    void commentUnionBusiness(OrderGoodsCommentDTO dto);
}

